package com.gym.core.date;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.gym.core.date.DateContants.DateFormatType;

/**
 * 
 * @author xinchun.wang 
   @email: 532002108@qq.com
 * @createTime 2015-1-5 下午5:59:26
 */
public class DateFormatUtils {
	private static final Logger logger = LoggerFactory.getLogger(DateFormatUtils.class);

	public static String parseDate(Date date, DateFormatType dateFormatType) {
		SimpleDateFormat fmt = DateContants.getDateFormat(dateFormatType);
		String result = "";
		synchronized (fmt) {
			result = fmt.format(date);
		}
		return result;
	}

	public static String parseDate(long datetime, DateFormatType dateFormatType) {
		return parseDate(new Date(datetime),dateFormatType);
	}
}
